package com.example.demo.controller;

import com.example.demo.entity.CreditCardApplyInfo;
import com.example.demo.service.RuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author lizhien (zhien.li@nascent.cn)
 * @Date 2020/8/4 19:47
 * @Version 1.0.0
 * @Description com.example.demo
 */

@RestController
public class RuleController {

    @Autowired
    private RuleService ruleService;

    @RequestMapping("/creditCradApply")
    public CreditCardApplyInfo creditCardApply(@RequestParam(value = "education", required = false, defaultValue = "专科以下") String education, @RequestParam(value = "hasHouse", required = false, defaultValue = "false") boolean hasHouse, @RequestParam(value = "hasCar", required = false, defaultValue = "false") boolean hasCar, @RequestParam(value = "monthlyIncome", required = false, defaultValue = "3500") int monthlyIncome) {
        CreditCardApplyInfo creditCardApplyInfo = new CreditCardApplyInfo();
        creditCardApplyInfo.setEducation(education);            //学历
        creditCardApplyInfo.setHasHouse(hasHouse);                 //是否有房
        creditCardApplyInfo.setHasCar(hasCar);                   //是否有车
        creditCardApplyInfo.setMonthlyIncome(monthlyIncome);             //月收入
        return ruleService.creditCardApply(creditCardApplyInfo);
    }
}
